package com.whj.serviceprice.generator;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Collections;

/**
 * @Auther: wanghaijun
 * @Date: 2023/1/12 - 01 - 12 - 16:43 
 * @Description: com.whj.servicedriveruser.generator
 */

/**
 * 自动生成代码工具类
 */
public class MysqlGenerator {
    public static void main(String[] args) {

        FastAutoGenerator.create("jdbc:mysql://192.168.3.220:12345/service-price?characterEncoding=utf8&serverTimezone=UTC",
                "root", "123456")
                .globalConfig(builder -> {
                    builder.author("whj").fileOverride().outputDir("D:\\JAVA_\\project\\online-taxi-public\\service-price\\src\\main\\java");
                })
                .packageConfig(builder -> {
                    builder.parent("com.whj.serviceprice").pathInfo(Collections.singletonMap(OutputFile.mapper,
                            "D:\\JAVA_\\project\\online-taxi-public\\service-price\\src\\main\\java\\com\\whj\\serviceprice\\mapper"));
                })
                .strategyConfig(builder -> {
                    builder.addInclude("price_rules");
                })
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}
